using System;
using System.Windows.Input;

namespace Rhizome.QuickStart.Elevator.ViewModel
{
    public sealed class DelegateCommand : ICommand
    {
        private readonly Action _execute;

        public DelegateCommand(Action execute)
        {
            if (execute == null) throw new ArgumentNullException("execute");
            _execute = execute;
        }

        public void Execute(object parameter)
        {
            _execute();
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged
        {
            add { }
            remove {  }
        }
    }
}